package com.woniuxy01;

import java.io.*;

/**
 * @author 作者
 * @create 2025-11-12 14:09
 */
public class Test03 {
    public static void main(String[] args) throws IOException {
        fileCopy("d:\\aaa\\a.pdf","d:\\aaa\\b.pdf");
    }

    //字符流复制文件
    public static void fileCopy(String source,String target) throws IOException {
        BufferedReader br=new BufferedReader(new FileReader(source));
        BufferedWriter bw=new BufferedWriter(new FileWriter(target));
        char[] chars=new char[1024];
        int length;
        while((length=br.read(chars))!=-1){
            bw.write(new String(chars));
            bw.flush();
        }
        bw.close();
        br.close();
    }
}
